package admin

import (
	database "hft/Database"
	"time"
)

type User struct {
	database.Base
	UUID            string    `json:"uuid"` //客户唯一标识
	Name            string    `json:"name" gorm:"index"`
	Phone           string    `json:"phone" gorm:"uniqueIndex:phone_city"`
	RegionLink      string    `json:"region" gorm:"index"`
	City            uint      `json:"city" gorm:"uniqueIndex:phone_city"`
	Level           string    `json:"level" gorm:"index"`
	Valid           int       `json:"valid"  gorm:"index"`
	NowBrokerID     int       `json:"nowBroker"`
	BrokerName      string    `json:"brokerName"`
	BrokerTime      time.Time `json:"brokerTime"`                 //管家首次跟进时间
	UseProductTimes int       `json:"useProductTimes"`            //使用产品次数
	BrokerNum       int       `json:"brokerNum"`                  //历史跟进人数
	AccountLink     string    `json:"account_link"`               //所属的账号
	IsShield        bool      `json:"is_shield" gorm:"default:0"` //是否屏蔽
	// Cate            int       `json:"cate"`                       //客户类别 1有效客户 2无效客户 3已成交
	RemarkList []*Remark `json:"remarkList" gorm:"foreignKey:UserId;references:ID;constraint:OnDelete:CASCADE"`
	ClueList   []*Clue   `json:"clueList" gorm:"foreignKey:UserId;references:ID;constraint:OnDelete:CASCADE"`
}

func (*User) TableName() string {
	return database.TableNameFormat("user")
}
